<meta charset="UTF-8">
<style>
th{
	text-align:center
}
td{
	text-align:center
}
</style>
<div class="content-wrapper" style="min-height: 901px;">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1 style="text-align:center">
        	食堂员工
      </h1>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-md-8 col-md-offset-2">
          <div class="box">
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover">
                <tbody>
                <tr>
                  <th>序号</th>
                  <th>姓名</th>
                  <th>操作</th>
                </tr>
                <tr ng-repeat="emp in emps">
                  <td>{{$index+1}}</td>
                  <td class="emp_name" data-name="{{emp.name}}">{{emp.name}}</td>
                  <td><button class="btn btn-danger" ng-click="delemp(emp.name,emp.id);">删除</button></td>
                </tr>
               </tbody>
			</table>
            </div>
            <!-- /.box-body -->
            <div class="box-footer">
            	<button class="btn btn-info col-md-4 col-md-4 col-md-offset-4 btn-lg" ng-click="newCemp()">维护员工</button>
            </div>
          </div>
          <!-- /.box -->
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  <!-- 删除食堂员工modal  -->
  <div class="modal fade" id="delEmp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">提示</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body">
           	确定要删除员工<b class="delempname"></b>吗？
           	<b class="delempid hidden"></b>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="del_emp()";>确定</button>
      </div>
    </div>
  </div>
</div>
<!-- 维护员工模态框  -->
  <div class="modal fade" id="maintain" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">维护员工</h4>
      </div>
    <form class="form-horizontal"> 
      <div class="modal-body form-horizontal">
        <div class="box" style="border: 0px;">
                <!-- box header -->
                           
                <div class="box-body" style="height:400px;overflow:auto;overflow-x:hidden">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2  col-sm-offset-2 control-label">用户名</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input type="text" class="form-control" placeholder="用户名" ng-model="newemp.username" required="required">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 col-sm-offset-2 control-label">姓名</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input type="text" class="form-control" placeholder="姓名" ng-model="newemp.name" required="required">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 col-sm-offset-2 control-label">工号</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input type="text" class="form-control" placeholder="工号" ng-model="newemp.employee_code">
                        </div>
                    </div>
                    <div class="form-group psw">
                        <label for="inputEmail3" class="col-sm-2 col-sm-offset-2 control-label">密码</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input type="password" class="form-control pswinput" placeholder="密码" ng-model="newemp.password" required="required">
                        </div>
                    </div>
                    <div class="form-group psw">
                        <label for="inputEmail3" class="col-sm-2 col-sm-offset-2 control-label">重复密码</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input type="password" class="form-control pswinput" placeholder="重复密码" ng-model="newemp.confirm_password" required="required">
                            <label style="color: red; display: none;" id="alertPsw">两次密码不一致！请重新输入</label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 col-sm-offset-2 control-label">手机号</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input type="text" class="form-control" maxlength="11" placeholder="手机号" ng-model="newemp.telephone" required="required">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 col-sm-offset-2 control-label">地址</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input type="text" class="form-control" placeholder="地址" ng-model="newemp.address">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-4 control-label">是否登录后台</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input class='tgl tgl-flat' id='backstage' type='checkbox'  ng-model="newemp.background_login_settings" >
    						<label class='tgl-btn' for='backstage'></label>
                        </div>
                    </div>
                    <!--<div class="form-group">
                        <label for="inputEmail3" class="col-sm-4 control-label">是否使用餐柜</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input class='tgl tgl-flat' id='cabinet' type='checkbox' ng-model="newemp.buffet_use_setting" >
    						<label class='tgl-btn' for='cabinet'></label>
                        </div>
                    </div>-->
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 col-sm-offset-2 control-label">权限级别</label>
                        <div class="col-sm-4 col-sm-offset-1">
                            <input type="text" class="form-control" data-toggle="modal" data-target="#level" id="checkedLevel" ng-model="newemp.rolenames"  ng-required="true" readonly="readonly">
                        	<label style="color: red; display: none;" id="alertLevel">请选择职级权限</label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 col-sm-offset-2 control-label">部门</label>
                        <div class="col-sm-4 col-sm-offset-1">
                           <select class="form-control select2 " style="width: 100%;" tabindex="-1" aria-hidden="true" ng-model="newemp.organization_id" required="required">
			                  <option ng-repeat="dept in depts" value="{{dept.id}}">{{dept.name}}</option>
			               </select>
			               <label style="color: red; display: none;" id="alertDept">请选择部门</label>
                        </div>
                    </div>
                    
                </div> 
                
                <!-- /.box-body -->
               
            </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="submit" class="btn btn-success btn-lg" ng-click="submitEmp()">确定</button>
      </div>
       </form> 
    </div>
  </div>
</div>
<!-- 新增权限选择modal -->
 <div class="modal fade" id="level" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">选择权限级别</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body">
        <span ng-repeat="level in levels">
           	<input type="radio" id="{{level.id}}newCemp" class="chk_1 newlevel" name="level" value="{{level.name}}" data-dataId = "{{level.id}}" ng-model="newemp.role_name"/>
				<label for="{{level.id}}newCemp" class="checklable"></label>{{level.name}}
        </span>
	    </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="levelToHtml();">确定</button>
      </div>
    </div>
  </div>
</div>